package com.sysmenu.dao;

import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.SqlMapClientTemplate;

import com.pojo.NewsPojo;

public class NewDaoImpl implements NewDao {
	private SqlMapClientTemplate sqlMapClienet;

	public int saveNews(NewsPojo newPojo) {
		Object obj = sqlMapClienet.insert("addnews", newPojo);
		if (obj == null)
			return 0;
		return (Integer) obj;

	}

	public List<NewsPojo> searchNewsList(Map<String, Object> paraMap) {
		return sqlMapClienet.queryForList("searchNews", paraMap);
	}

	public int searchNewsCount(Map<String, Object> paraMap) {
		Object obj = sqlMapClienet.queryForObject("searchNewscount");
		if (obj == null) {
			return 0;
		}
		return (Integer) obj;
	}

	public SqlMapClientTemplate getSqlMapClienet() {
		return sqlMapClienet;
	}

	public void setSqlMapClienet(SqlMapClientTemplate sqlMapClienet) {
		this.sqlMapClienet = sqlMapClienet;
	}
}
